$(document).ready(function() {
    ifLoged();
    //需要参数 订单id 支付方式 酒店名称 床位名称 总价格 等
    var sec = location.href.split('?')[1],
        d = JSON.parse(decodeURIComponent(sec)); //得到原json数据
    console.log(d);
    $('.hotelName').html(d.hotel.name);
    $('.total-price').html(d.amount);
    $('.roomName').html(d.roomName);
    $('.payItem').on('click', function() {
        $(this).addClass("active").siblings().removeClass("active");
    });
    $('.goPay').on('click', function() {
        ajaxXHR('post', url + 'v1/order/pay', function(data) {
            if (data.code != 'success') {
                console.log(data.message);
            } else {
                $('.modal-body').html('支付成功!<a href="myIndent.html">去我的订单页查看</a>');
                $('.modal').modal('show');
            }
        }, {
            token: localStorage.APISHoteltoken,
            payType: $('.payItem.active')[0].dataset.value,
            orderId: d._id
        }, 'json');
    });

});